package com.nandi.deviceinstall.ui.activity

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.nandi.deviceinstall.R
import com.nandi.deviceinstall.bean.ListDataBean
import com.nandi.deviceinstall.ui.adapter.DataAdapter
import kotlinx.android.synthetic.main.activity_data_show.*
import kotlinx.android.synthetic.main.toolbar_back_include.*

class DataShowActivity : AppCompatActivity() {
    private lateinit var mAdapter: DataAdapter

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_data_show)

        val data = intent.extras.getSerializable("data") as ListDataBean

        tv_title_toolbar.text = "监测数据"
        ll_right.visibility = View.GONE

        iv_back_toolbar.setOnClickListener {
            finish()
        }

        dataShow.layoutManager = LinearLayoutManager(this)
        mAdapter = DataAdapter(R.layout.item_data)
        dataShow.adapter = mAdapter
        val inflate = LayoutInflater.from(this).inflate(R.layout.item_data_header, null)
        mAdapter.addHeaderView(inflate)
        mAdapter.setNewData(data.data?.monitoringData)
    }
}
